# encoding: utf-8
# @project: st2111 
# @file: re_flags_dotall.py
# @time: 2023/4/13 15:43
# @author: abcque
# @license: (C) Copyright 2013-2021
# @contact: abcque@outlook.com
# @IDE: PyCharm
# @desc:
import re

if __name__ == "__main__":
    text = 'This is some text -- with punctuation.\nA second line.'
    pattern = r'.+'
    no_newlines = re.compile(pattern)
    dotall = re.compile(pattern, re.DOTALL)
    print('Text:\n  {!r}'.format(text))
    print('Pattern:\n  {}'.format(pattern))
    print('No newlines :')
    for match in no_newlines.findall(text):
        print('  {!r}'.format(match))
    print('Dotall      :')
    for match in dotall.findall(text):
        print('  {!r}'.format(match))